<?php
/**
 * 系统主框架以及公共显示区域
 * @author Bruce
 * time 2014-10-30
 */
namespace apps\fzq\controllers;

if( ! APP_ROOT  ) return 'Direct Access Deny!';

class ToolsController extends \Phalcon\Mvc\Controller
{
	public function initialize()
	{
	}
	
	/**
	 * @author( author='qzf' )
	 * @date( date = '?' )
	 * @comment( comment = '取验证码' )
	 * @method( method = 'getVerifyAction' )
	 * @op( op = 'r' )
	 */
	public function getVerifyAction( )
	{
		$iWidth = (( $iWidth = $this->dispatcher->getParam( 'w' )) != null ) ? $iWidth : 150;//width
		$iHeight = (( $iHeight = $this->dispatcher->getParam( 'h' )) != null ) ? $iHeight : 30;//height
		$iFontSize = (( $iFontSize = $this->dispatcher->getParam( 'fontsize' )) != null) ? $iFontSize : 18;//fontsize
		$bUseCurve = (( $bUseCurve = $this->dispatcher->getParam( 'curve' )) != null ) ? intval( $bUseCurve ) : true; //curve
		$bImg = (( $bImg = $this->dispatcher->getParam( 'image' )) != null ) ? intval( $bImg ) : false;//image
		$bNoise = (( $bNoise = $this->dispatcher->getParam( 'noise' )) != null ) ? intval( $bNoise ) : true;//noise
		$iLength = (( $iLength = $this->dispatcher->getParam( 'length' )) != null ) ? $iLength : 5;//length
		$id = (( $id = $this->dispatcher->getParam( 'id' )) != null ) ? $id : 1;
		
		$verify = $this->di->get( 'verify' );
		$verify->useImgBg = $bImg;
		$verify->fontSize = $iFontSize;
		$verify->useCurve = $bUseCurve;
		$verify->useNoise = $bNoise;
		$verify->imageH = $iHeight;
		$verify->imageW = $iWidth;
		$verify->length = $iLength;
		
		echo $verify->entry( $id );
	}
	
}
